package com.zlt.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.zlt.annotation.Column;
import com.zlt.annotation.Id;
import com.zlt.annotation.ManyToOne;
import com.zlt.annotation.Table;

import javax.xml.crypto.Data;

@Table(name = "order")
public class Order {

    @Id(name = "order_id")
    private int oid;// 订单信息主键id

    @Column(name = "order_num")
    @JSONField
    private int num;// 订单号

    @ManyToOne(name = "cart_id")
    @JSONField
    private Cart cart;// 外键，购物车id

    @Column
    @JSONField
    private int state;// 订单状态，0-未支付，1-待支付，2-已支付

    @Column(name = "createtime")
    @JSONField
    private Data createTime;// 订单创建时间

    @Column(name = "paytime")
    @JSONField
    private Data payTime;// 支付时间

    public Order() {
    }

    public Order(int oid, int num, Cart cart, int state, Data createTime, Data payTime) {
        this.oid = oid;
        this.num = num;
        this.cart = cart;
        this.state = state;
        this.createTime = createTime;
        this.payTime = payTime;
    }

    public int getOid() {
        return oid;
    }

    public void setOid(int oid) {
        this.oid = oid;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public Cart getCart() {
        return cart;
    }

    public void setCart(Cart cart) {
        this.cart = cart;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public Data getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Data createTime) {
        this.createTime = createTime;
    }

    public Data getPayTime() {
        return payTime;
    }

    public void setPayTime(Data payTime) {
        this.payTime = payTime;
    }

    @Override
    public String toString() {
        return "Order{" +
                "oid=" + oid +
                ", num=" + num +
                ", cart=" + cart +
                ", state=" + state +
                ", createTime=" + createTime +
                ", payTime=" + payTime +
                '}';
    }
}
